package com.emspost.utils;

import cn.hutool.core.util.IdUtil;
import org.jasypt.encryption.StringEncryptor;
import org.jasypt.encryption.pbe.StandardPBEStringEncryptor;
import org.jasypt.salt.RandomSaltGenerator;

public class DbPasswordUtil {
    public static void main(String[] args) {
        StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor();
        // 数据资产生产密码
        encryptor.setPassword("Bot!VM7x#w4X^9blb69kwgWCk7AjC&DivIdYzxEh&LUn4dlWHJKt2^LJ&3Vrz&Vi&w01o6GPCK9za674IsR8Lv2cidNP%vpu%3W04Td4S$0YZGo3G#ZI*T%yEBSwgT7f");
//        encryptor.setPassword("RISK_CHECK_SRV");
//        encryptor.setPassword("RISK_BACK");
        //测试密码
//        encryptor.setPassword("test");
//        encryptor.setPassword("QRCODE_FORWARD");
//        encryptor.setPassword("ETRACK_BACK");
        encryptor.setAlgorithm("PBEWithMD5AndDES");
//        encryptor.setSaltGenerator(new RandomSaltGenerator());
//        String encryptedText = encryptor.encrypt("V6biGE_sEf3D");//生产pgsql密码 digisight_807/V6biGE_sEf3D
//        String encryptedText = encryptor.encrypt("MEMQ38_VPe05");//生产redis密码 digisight_807/MEMQ38_VPe05
//        String encryptedText = encryptor.encrypt("WPJ94U_nXhar");//生产nacos密码 digisight_807/WPJ94U_nXhar
        String encryptedText = encryptor.encrypt("Ria85sP4m!");//生产es密码 dev_user01/6MJ_@Uw90  /807_digisight/Ria85sP4m!(新密码)
//        String encryptedText = encryptor.encrypt("es#AAA111aaa");//测试用
//        String encryptedText = encryptor.encrypt("euc_AAA111aaa!");//测试用

        System.out.println("加密密码:"+encryptedText);
//        System.out.println("加密密码:"+encryptedText);
        String plainText = encryptor.decrypt(encryptedText);
//        String plainText = encryptor.decrypt("4Ik/Xik/W8l4W3v543Ka14OiVz0rqqTf");
        System.out.println("解密密码:"+plainText);
//        String plainText1 = encryptor.decrypt("5ETKQb9TUr/7ErB9+TVMuFIrAjYAus8ej+GC+kwN9xI=");
//        System.out.println("解密密码1:"+ plainText1 );
//        String secret_key = IdUtil.simpleUUID();
//        System.out.println(secret_key);


    }




}
